import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:provider/provider.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBColor/YBColor.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBTextStyle/YBTextStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/yb_chinese_text/yb_chinese_text.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBMineModule/YBMineProvider/YBMineProvider.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBMineModule/YBMyGongDanPage/YBShangJiDetailSubPage.dart';


class YBShangJiDetailPgae extends StatelessWidget {

  final String sysCode;
  final String requestCode;

  const YBShangJiDetailPgae({Key key, this.sysCode, this.requestCode}) : super(key: key);


  @override
  Widget build(BuildContext context) {

    return Container(
       child: Scaffold(
         appBar: AppBar(
           title: Text(YBChineseText.workTaiShangJiDetailTitle,style: YBTextStyle.TextStyle30313320Medium),
           elevation: 0,
         ),
         body:ChangeNotifierProvider(
             create: (context) => YBMineMyGongDanDetailProvider()..getShangJiKuData(sysCode, requestCode),
             child: Consumer<YBMineMyGongDanDetailProvider>(
                 builder: (context,shangDetailModel,child){
                   Widget detailModelMiaoShuInfoWidget;
                   Widget hangYeWidget;
                   Widget yuSuanWidget;
                   if (shangDetailModel.gongDanDetailModel != null){
                     if (shangDetailModel.gongDanDetailModel.requestServiceDesc != null){
                       detailModelMiaoShuInfoWidget = Container(
                          child: Column(
                            mainAxisAlignment: MainAxisAlignment.start,
                            crossAxisAlignment: CrossAxisAlignment.stretch,
                            children: [
                              Container(
                                height: YBTextStyle.adapterSize8,
                                color: YBColor.colorF5F5F7,
                              ),
                              Container(
                                color: YBColor.white,
                                child: Padding(
                                  padding: EdgeInsets.only(left: YBTextStyle.adapterSize20,right: YBTextStyle.adapterSize20,top: YBTextStyle.adapterSize16),
                                  child: Text(
                                    YBChineseText.workTaiXuQiuMiaoShuTitle,
                                    style: YBTextStyle.TextStyle1B1C1F18Medium,
                                  ),
                                ),
                              ),
                              Container(
                                color: YBColor.white,
                                child: Padding(
                                  padding: EdgeInsets.only(top: YBTextStyle.adapterSize16,bottom: YBTextStyle.adapterSize16,left: YBTextStyle.adapterSize20,right: YBTextStyle.adapterSize20),
                                  child: Text(
                                    shangDetailModel.gongDanDetailModel.requestServiceDesc??"",
                                    style: YBTextStyle.TextStyle71747A14,
                                  ),
                                ),
                              ),
                            ],
                          ),
                        );
                     }else {
                       detailModelMiaoShuInfoWidget = Container();
                     }
                   }

                   if (shangDetailModel.gongDanDetailModel != null){
                     if (shangDetailModel.gongDanDetailModel.budgetMoneyDesc != null){
                        yuSuanWidget = Container(
                          child: Column(
                            children: [
                              Container(
                                height: 8,
                                color: YBColor.colorF5F5F7,
                              ),
                              Container(
                                color: YBColor.white,
                                height: YBTextStyle.adapterSize48,
                                child: Padding(
                                  padding: EdgeInsets.only(left: YBTextStyle.adapterSize20,right: YBTextStyle.adapterSize20),
                                  child: Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    crossAxisAlignment: CrossAxisAlignment.center,
                                    children: [
                                      Container(
                                        child: Text(
                                          YBChineseText.workTaiYuSuanTitle,
                                          style: YBTextStyle.TextStyle1B1C1F18Medium,
                                        ),
                                      ),
                                      Container(
                                        child: Text(
                                          shangDetailModel.gongDanDetailModel.budgetMoneyDesc??"",
                                          style: YBTextStyle.TextStyle000000A14,
                                        ),
                                      ),
                                    ],
                                  ),
                                ),
                              ),
                            ],
                          ),
                        );
                     }else{
                        yuSuanWidget = Container();
                     }
                   }

                   if (shangDetailModel.gongDanDetailModel != null){
                      if (shangDetailModel.gongDanDetailModel.userIndustry != null){
                        hangYeWidget = Container(
                          child: Column(
                            children: [
                              Container(
                                height: YBTextStyle.adapterSize8,
                                color: YBColor.colorF5F5F7,
                              ),
                              Container(
                                height: YBTextStyle.adapterSize48,
                                color: YBColor.white,
                                child: Padding(
                                  padding: EdgeInsets.only(left: YBTextStyle.adapterSize20,right: YBTextStyle.adapterSize20),
                                  child: Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    crossAxisAlignment: CrossAxisAlignment.center,
                                    children: [
                                      Container(
                                        child: Text(
                                          YBChineseText.workTaiHangYeTitle,
                                          style: YBTextStyle.TextStyle1B1C1F18Medium,
                                        ),
                                      ),
                                      Container(
                                        child: Text(
                                          shangDetailModel.gongDanDetailModel.userIndustry??"",
                                          style: YBTextStyle.TextStyle000000A14,
                                        ),
                                      ),
                                    ],
                                  ),
                                ),
                              ),
                            ],
                          ),
                        );
                      }else{
                        hangYeWidget = Container();
                      }
                   }


                   return shangDetailModel.gongDanDetailModel != null?Column(
                     children: [
                       Expanded(
                         child: SingleChildScrollView(
                           child: Column(
                             mainAxisAlignment: MainAxisAlignment.start,
                             crossAxisAlignment: CrossAxisAlignment.stretch,
                             children: [
                               Container(
                                 child: YBShangJiDetailSubPage(requestTagStr:shangDetailModel.gongDanDetailModel.requestTag??"",number: shangDetailModel.gongDanDetailModel.maxGetOrderNumber.toString()??"",addressStr: shangDetailModel.gongDanDetailModel.address??"",linkPhone: shangDetailModel.gongDanDetailModel.linkPhone??"",createTime: shangDetailModel.gongDanDetailModel.createTime??"",),
                               ),
                               Container(
                                 child: Column(
                                   mainAxisAlignment: MainAxisAlignment.start,
                                   crossAxisAlignment: CrossAxisAlignment.stretch,
                                   children: [
                                      detailModelMiaoShuInfoWidget,
                                      hangYeWidget,
                                      yuSuanWidget,
                                   ],
                                 ),
                               ),
                             ],
                           ),
                         ),
                       ),
                     ],
                   ):Container();
                 }
             ),
         ),
       ),
    );
  }
}
